<?php 

/* ------------------------------------------------------------
 * Page: Home
 * Author: Gustavo Lozano & Fredrik Kronander
 * Description: Page to with a form to contact the administratot
 * 
 **------------------------------------------------------------*/

?>


<script Language="Javascript">

  
$(document).ready(function(){
    $("#contactform").validate({
    errorLabelContainer: $("#RegisterErrors"),
    
    messages: {
              email: "valid email adress is required, <br/>",
              subject: "subject is required, <br/>",
              message: "message is required, ",
              
          }
    
    
    });
  });
 </script>


<?php 
/*------------------------------------------------------------
 * Page: ContactUs
 *	Author: Gustavo Lozano
 *	Description: Simple page for the user to sumbit an email to contact the company 
 *	Others: 
 *
 ------------------------------------------------------------*/

require_once 'source/UtsAirs.php';

if(isset($_REQUEST['mail']))
{
	
	$uts = new UtsAirs();
	
	$from = $_REQUEST['email'];
	$subject= $_REQUEST['subject'];
	
	$message = $_REQUEST['firstName']. " ". $_REQUEST['lastName']. " \n";
	$message = $message. "Email: ". $from. " \n \n";
	$message = $message." ".$_REQUEST['message'];
	
	$uts->sendEmailContactUS($subject, $message);
	
	echo "Email Send, Thank You";
}

?>

<h1>Contact Us</h1>

<form method="post" action="index.php?content=Contact" id="contactform" name="contactform">
	<table align="left">
		<tr>
			<td>
				First Name:
			</td>
			<td> 
				<input type="text" name="firstName" id="lastName"/>
			</td>
		</tr>
		
		<tr>
			<td>
				Last Name:
			</td>
			<td>
				<input type= "text" name="lastName" id="lastName" />
			</td>
		</tr>
		
		<tr>
			<td>
				Your Email:<span style="color: red;">*</span>
			</td>
			<td>
				<input type="text" class="required email" name="email" id="email" />
			</td>
		</tr>
		
		<tr>
			<td>
				Subject: <span style="color: red;">*</span>
			</td>
			<td>
				<input type="text" class="required" name="subject" id="subject"/>
			</td>
		</tr>
		
		<tr>
			<td colspan="2">
				Message: <span style="color: red;">*</span><br><textarea class="required" name="message" id="message" rows="8" cols="40"></textarea>
			</td>
		</tr>
		
		<tr>
			<td colspan="2" align="right"><input type="submit"" value="Send"/></td>
		</tr>
		
		<tr>
			<td colspan="2" align="right">
				<div id="RegisterErrors" style="display:none"></div>
			</td>
		</tr>
		
	</table>
	
		<input type="hidden" name="mail" value="yes" />
	
	
</form>
